<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>易能旅游网站--生成订单</title>
	<%@ include file="/pages/common/common_f.jsp" %>	
	<style type="text/css">
		a:hover{
			text-decoration: none;
		}
	
		.tknr{
			width: 744px;
			height: 200px;
			overflow: auto;
		}
		
		tr{
			height: 28px;
		}
		
		td.titletd{
			width: 80px;
			text-align: right;
		}
		
		input{
			width: 150px;
			height:20px;
			border: 1px solid #92B7D0;
			
		}
	</style>
	<script type="text/javascript">
			$(function(){
				$('#doubleRoom').change(freshPrice);
				$('#singleRoom').change(freshPrice);
				$('#childHaveBed').change(freshPrice);
				$('#childNoBed').change(freshPrice);
				$('#addBed').change(freshPrice);
			});
			
			function freshPrice(){
				var doubleRoom=$('#doubleRoom').val();
				var singleRoom=$('#singleRoom').val();
				var childHaveBed=$('#childHaveBed').val();
				var childNoBed=$('#childNoBed').val();
				var addBed=$('#addBed').val();
				$('#totalNum').val(parseInt(doubleRoom)+parseInt(singleRoom)+parseInt(childHaveBed)+parseInt(childNoBed)+parseInt(addBed));
				var href='${ctx}/book/getPriceTable.usr?';
				href+='doubleRoom='+doubleRoom;
				href+='&singleRoom='+singleRoom;
				href+='&childHaveBed='+childHaveBed;
				href+='&childNoBed='+childNoBed;
				href+='&addBed='+addBed;
				
				$('#tt').panel('refresh',href);
			}
			
			function submitOrder(){
				
				if(!$('#haveRead').attr("checked")==true){
					$.messager.alert('提示','请先阅读条款内容','info');
					return false;
				}
				var r = $('#orderForm').form('validate');
				if(!r) {
					return false;
				}
				if($('#goTime').val()==""){
					$.messager.alert('提示','请输入启程日期','info');
					return false;
				}
				if($('#backTime').val()==""){
					$.messager.alert('提示','请输入返回日期','info');
					return false;
				}
				var totalNum=$('#totalNum').val();
				if(totalNum=="0"||totalNum=="NaN"){
					$.messager.alert('提示','总人数不能为0','warning');
					return false;
				}
				if(${routeVo.groupType}==${constant.GROUP_TYPE_SIX}&&parseInt(totalNum)>6){
					$.messager.alert('提示','超出1-6人团的最大人数限制!','warning');
					return false;
				}
				if(${routeVo.groupType}==${constant.GROUP_TYPE_SEVEN}&&(parseInt(totalNum)>38||parseInt(totalNum)<7)){
					$.messager.alert('提示','超出7-38人团的最大人数限制或少于7人!','warning');
					return false;
				}
				if($('#orderTotalAmount').val()==""){
					$.messager.alert('提示','非法订单，不能提交','error');
					return false;
				}
				
				$('#orderForm').attr('action','${ctx}/book/book.usr');
				$('#orderForm').attr('target','_self');
				$('#orderForm').submit();//提交表单
			}
			
			function openPrint(){
				$('#orderForm').attr('action','${ctx}/book/printOrder.usr');
				$('#orderForm').attr('target','_blank');
				$('#orderForm').submit();
			}
			
	</script>	
	
  </head>
  <body style="margin:0;padding:0;height:100%;overflow:scroll;background:#F2FBFF">
  	<div class="main">
		<jsp:include page="/pages/front/inc/header.jsp"></jsp:include><!-- 顶部导航 -->
		<div class="info">
			<span class="location"><span style="font-weight: bold;">位置：</span>首页>${countryName}>${route.orgCityCn}>自助估价><c:if test="${type eq constant.GROUP_TYPE_SIX}">1-6人团</c:if><c:if test="${type eq constant.GROUP_TYPE_SEVEN}">7-38人团</c:if></span>
			<span class="user"><jsp:include page="/pages/front/inc/login_info.jsp"/></span>
		</div>
		<div class="content">
			<div class="left">
				<jsp:include page="/country/queryAll.usr"></jsp:include><!-- 左侧国家 -->
			</div>
			<div class="right" id="right">
				<!-- 右侧内容区域 -->
				<div style="margin: 5px;">
					<h2 style="background-image: url('${ctx}/img/front/info.png')">条款信息</h2>
					<textarea class="tknr">
						条款内容
						条款内容条款内容
						条款内容
					</textarea>
					<div style="text-align: center;"><input type="checkbox" id="haveRead" style="width: 15px;"/>我已同意协议条款内容</div>
				</div>
				<form id="orderForm" method="post">
				<div style="margin: 5px;">
					<h2 style="background-image: url('${ctx}/img/front/users.png')">订单信息</h2>
					<div>
						<table cellspacing="0">
							<tr>
								<td class="titletd">行程：</td>
								<td width="280px">${route.day }天${route.night }夜    ${route.routeName}</td>
								<td class="titletd">出发地：</td>
								<td>${route.orgCityCn}</td>
							</tr>
							<tr>
								<td class="titletd">启程日期：</td>
								<td><input type="text" required="true" name="goTime" id="goTime" onfocus="WdatePicker({minDate:'%y-%M-%d'})"/></td>
								<td class="titletd">返回日期：</td>
								<td><input type="text" required="true" name="backTime" id="backTime" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'goTime\',{d:${route.day-1 }});}'})"/></td>
							</tr>
							<tr>
								<td class="titletd">双人间：</td>
								<td><input type="text" value="0" name="doubleRoomCount" id="doubleRoom" class="easyui-numberbox" min="0" max="38" precision="0" required="true"/>人</td>
								<td class="titletd">单人间：</td>
								<td><input type="text" value="0" name="singleRoomCount" id="singleRoom" class="easyui-numberbox" min="0" max="38" precision="0" required="true"/>人</td>
							</tr>
							<tr>
								<td class="titletd">儿童占床：</td>
								<td><input type="text" value="0" name="childBedCount" id="childHaveBed" class="easyui-numberbox" min="0" max="38" precision="0" required="true"/>人</td>
								<td class="titletd">儿童不占床：</td>
								<td><input type="text" value="0" name="childNoBedCount" id="childNoBed" class="easyui-numberbox" min="0" max="38" precision="0" required="true"/>人</td>
							</tr>
							<tr>
								<td class="titletd">加床：</td>
								<td><input type="text" value="0" name="addBedCount" id="addBed" class="easyui-numberbox" min="0" max="38" precision="0" required="true"/>人</td>
								<td class="titletd">总人数：</td>
								<td><input type="text" readonly="readonly" name="totalCount" id="totalNum" value="0" style="background-color: #ccc;"/>人</td>
							</tr>
							<tr>
								<td class="titletd">备注：</td>
								<td colspan="3"><textarea name="remark" style="width: 250px;height: 100px;border: 1px solid #92B7D0;"></textarea></td>
							</tr>
						</table>
					</div>
				</div>		
				<div style="margin: 5px;">
					<h2 style="background-image: url('${ctx}/img/front/rmb.png')">价格信息</h2>
					<div id="tt" class="easyui-panel" style="padding: 5px;" title="配套价格（人民币/每人/每套）" cache="false" 
					collapsible="false" minimizable="false" maximizable="false" closable="false" href="${ctx}/book/getPriceTable.usr">
						  	
					</div><!-- end panel -->
				</div>
				</form>
				<div style="text-align: center;margin-top: 10px;">
				<a style="text-decoration: none;" onclick="location.href='${ctx}/route/queryRoute.usr?routeId=${route.routeId}&type=${routeVo.groupType}&back=0'" class="easyui-linkbutton" iconCls="icon-undo">上一步</a>
					<a style="text-decoration: none;" onclick="submitOrder();" class="easyui-linkbutton" iconCls="icon-ok">提交订单</a>
					<a style="text-decoration: none;" onclick="openPrint();" class="easyui-linkbutton" iconCls="icon-print">打印</a>
				</div>
			</div><!-- end right -->
			<div class="vertical-border" style="height: 900px;"></div><!-- center border-line -->
		</div><!-- end content -->
	</div><!-- end main -->
	
</body>

</html>
